﻿{include file="../application/admin/view/common/header.html" /}
<style type="text/css">
    .radio-box {
        display: inline-block;
        width: 64px;
    }

    /* .formControls{padding-right:50px; position: relative;} */
    .textarea {
        height: 100px;
        resize: none;
        font-size: 14px;
        padding: 4px;
    }

    .textarea-numberbar {
        position: absolute;
        right: 70px;
        bottom: 5px;
        z-index: 1;
        margin-bottom: 0;
    }

    .bg-c {
        background-color: #23b7e5;
        color: #fff;
    }
</style>
<!--main content start-->
<section class="main-content">
    <!--start page content-->
    <div class="row">

        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="tabs">
                        <!-- Nav tabs -->
                        <ul class="list-inline tabs-nav" role="tablist">
                            <li role="presentation" class="active" id="index"><a href="#home" aria-controls="home"
                                                                                 role="tab" data-toggle="tab"
                                                                                 aria-expanded="true">页面描述</a></li>
                            <li role="presentation" class="" id="senstive_words"><a href="#profile"
                                                                                    aria-controls="profile" role="tab"
                                                                                    data-toggle="tab"
                                                                                    aria-expanded="false">敏感词</a></li>
                            <li role="presentation" class="" id="img"><a href="#messages" aria-controls="messages"
                                                                         role="tab" data-toggle="tab"
                                                                         aria-expanded="false">附件设置</a></li>
                        </ul>
                        <!-- Tab panes -->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane active" id="home">
                                <form class="form form-horizontal" id="form1">
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">网站名称：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="name" class="input-text" value=""
                                                   placeholder="不得超过50字" name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">站点网址：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="address" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>

                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">网站主页链接：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="link" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">文档默认保存路径：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="root" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">网站版权信息：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="info" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">站点默认关键字：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="keyword" class="" value="" placeholder="八个字以内用分号隔开"
                                                   name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">网站备案号：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="w_r_n" class="" value="" placeholder="" name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">备注：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <textarea name="" id="remark" cols="" rows="" class="textarea"
                                                      placeholder="说点什么..." dragonfly="true"></textarea>

                                        </div>
                                    </div>

                                    <div class="row cl">
                                        <div class="col-xs-8 col-sm-9 col-sm-9 col-xs-offset-5 col-sm-offset-5">
                                            <input class="btn btn-primary radius bg-c" onclick="ajaxSub(1)"
                                                   type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                                            <input class="btn radius" style="color: #ffffff;background-color: #a0a0a0;"
                                                   type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
                                        </div>
                                    </div>
                                </form>

                            </div>
                            <div role="tabpanel" class="tab-pane" id="profile">
                                <form class="form form-horizontal" id="form2">
                                    <div class="row cl" style="min-width: 720px;">

                                        <div class="formControls col-xs-11 col-sm-11">
                                            <textarea name="" cols="" rows="" class="textarea" id="textarea"
                                                      placeholder="说点什么..." dragonfly="true"></textarea>

                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <div class="col-xs-8 col-sm-9 col-sm-9 col-xs-offset-5 col-sm-offset-5">
                                            <input class="btn btn-primary radius bg-c" type="button"
                                                   onclick="ajaxSub(2)" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                                            <input class="btn radius" style="color: #ffffff;background-color: #a0a0a0;"
                                                   type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
                                        </div>
                                    </div>
                                </form>

                            </div>
                            <div role="tabpanel" class="tab-pane" id="messages">
                                <form class="form form-horizontal" id="form3">
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">图片地址：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="i_address" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>

                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">图片宽度：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="i_wide" class="input-text" value=""
                                                   placeholder="请填写图片的显示宽度" name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">图片高度：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="i_high" class="input-text" value=""
                                                   placeholder="请填写图片的显示高度" name="">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-5 col-sm-5">链接地址：</label>
                                        <div class="formControls col-xs-6 col-sm-5">
                                            <input type="text" id="i_link" class="input-text" value="" placeholder=""
                                                   name="">
                                        </div>
                                    </div>

                                    <div class="row cl">
                                        <div class="col-xs-8 col-sm-9 col-xs-offset-5 col-sm-offset-5">
                                            <input class="btn btn-primary radius bg-c" type="button"
                                                   onclick="ajaxSub(3)" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                                            <input class="btn radius" style="color: #ffffff;background-color: #a0a0a0;"
                                                   type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
                                        </div>
                                    </div>
                                </form>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div><!--end row-->

    <!--end page content-->


</section>
<!--end main content-->


<!--Common plugins-->
<script src="_JS_/jquery.min.js"></script>
<script src="_JS_/jquery.base64.js"></script>
<script src="_JS_/jquery.cookie.js"></script>
<script src="_JS_/bootstrap.min.js"></script>
<script src="_JS_/jasny-bootstrap.min.js"></script>
<script src="_JS_/jquery.slimscroll.min.js"></script>
<script src="_JS_/jquery.nanoscroller.min.js"></script>
<script src="_JS_/metismenu.min.js"></script>
<script src="_JS_/float-custom.js"></script>
<script type="text/javascript" src="_JS_/layer/layer.js"></script>
<!-- <script src="js/footable.all.min.js"></script> -->
<!-- Page-Level Scripts -->
<script>
    $(function () {
        $("#page-title").html("参数管理");
    })
    $(function () {
        get('index', 1);
    });

    $('#index').on('click', function () {
        get('index', 1);
    });

    $('#senstive_words').on('click', function () {
        get('keyword', 2);
    });

    $('#img').on('click', function () {
        get('img', 3);
    });

    function get(name, status) {
        $.ajax({
            type: 'get',
            url: "{:url('api/Param/index')}",
            dataType: 'jsonp',
            jsonp: 'callback',
            data: {
                'name': name,
            },
            success: function (msg) {
                $("#system_management").addClass("active").children("ul").addClass("in");
                $("#param_management").addClass("choose");
                if (msg.code == 200) {
                    var data = msg['data'];
                    put(data, status);
                } else {
                    layer.msg('数据获取失败，请刷新重试！', {icon: 2, time: 1000});
                }
            },
            error: function () {
                layer.msg('网络错误');
            },
        });
    }

    function put(data, status) {
        if (status == 1) {
            $('#name').val(data['name']);
            $('#address').val(data['address']);
            $('#link').val(data['link']);
            $('#root').val(data['root']);
            $('#info').val(data['info']);
            $('#keyword').val(data['keyword']);
            $('#w_r_n').val(data['w_r_n']);
            $('#remark').val(data['remark']);
        } else if (status == 2) {
            $('.textarea').val(data);
        } else {
            $('#i_address').val(data['i_address']);
            $('#i_wide').val(data['i_high']);
            $('#i_high').val(data['i_link']);
            $('#i_link').val(data['i_wide']);
        }
    }

    function ajaxSub(status) {
        if (status == 1) {
            var name = $('#name').val();
            address = $('#address').val();
            link = $('#link').val();
            root_ = $('#root').val();
            info = $('#info').val();
            keyword = $('#keyword').val();
            w_r_n = $('#w_r_n').val();
            remark = $('#remark').val();
            var data = 'status=' + status + '&name=' + name + '&address=' + address + '&link=' + link + '&root=' + root_ + '&info=' + info + '&keyword=' + keyword + '&w_r_n=' + w_r_n + '&remark=' + remark;
            sub(data);
        } else if (status == 2) {
            var textarea = $('#textarea').val();
            var data = 'status=' + status + '&textarea=' + textarea;
            sub(data);
        } else {
            var i_address = $('#i_address').val();
            i_high = $('#i_wide').val();
            i_link = $('#i_high').val();
            i_wide = $('#i_link').val();
            var data = 'status=' + status + '&i_address=' + i_address + '&i_wide=' + i_wide + '&i_high=' + i_high + '&i_link=' + i_link;
            sub(data);
        }
    }

    function sub(data) {
        $.ajax({
            type: "get",
            url: "{:url('api/Param/edit')}?" + data,
            dataType: 'jsonp',
            jsonp: 'callback',
            success: function (msg) {
                layer.msg(msg.message, {icon: 1, time: 1000}, function () {
                    window.location.reload();
                })
            },
            error: function () {
                layer.msg('网络错误');
            }
        });
    }
</script>
</body>
</html>